package com.dmc.scrabblator;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WordValueUtil
{
	public static final int LETTERS_IN_ALPHA = 26;

	private static final Map<Character, Integer> wwfCharVal = new HashMap<Character, Integer>(
			LETTERS_IN_ALPHA * 2 + 1)
	{
		private static final long serialVersionUID = 1L;

		{
			this.put('a', 1);
			this.put('b', 4);
			this.put('c', 4);
			this.put('d', 2);
			this.put('e', 1);
			this.put('f', 4);
			this.put('g', 3);
			this.put('h', 3);
			this.put('i', 1);
			this.put('j', 10);
			this.put('k', 5);
			this.put('l', 2);
			this.put('m', 4);
			this.put('n', 2);
			this.put('o', 1);
			this.put('p', 4);
			this.put('q', 10);
			this.put('r', 1);
			this.put('s', 1);
			this.put('t', 1);
			this.put('u', 2);
			this.put('v', 5);
			this.put('w', 4);
			this.put('x', 8);
			this.put('y', 3);
			this.put('z', 10);
			this.put('A', 1);
			this.put('B', 4);
			this.put('C', 4);
			this.put('D', 2);
			this.put('E', 1);
			this.put('F', 4);
			this.put('G', 3);
			this.put('H', 3);
			this.put('I', 1);
			this.put('J', 10);
			this.put('K', 5);
			this.put('L', 2);
			this.put('M', 4);
			this.put('N', 2);
			this.put('O', 1);
			this.put('P', 4);
			this.put('Q', 10);
			this.put('R', 1);
			this.put('S', 1);
			this.put('T', 1);
			this.put('U', 2);
			this.put('V', 5);
			this.put('W', 4);
			this.put('X', 8);
			this.put('Y', 3);
			this.put('Z', 10);
			this.put(' ', 0);
		}
	};

	private static Map<Character, Integer> activeMap = wwfCharVal;

	public static int getCharVal(char c)
	{
		return wwfCharVal.get(c);
	}

	public static List<Character> stringToCharList(String s)
	{
		List<Character> charList = new ArrayList<Character>();
		if (s == null)
			return charList;
		char[] chars = s.toCharArray();

		for (char c : chars)
		{
			charList.add(c);
		}

		return charList;

	}

}
